﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Bus_proj.website
{
    public partial class report_mount : System.Web.UI.Page
    {
        public string ConvestToDate_check(string s)
        {
            int day = 1;
            int mount = 1;
            int years = 1111;
            try
            {
                string[] stemp = s.Split(' ');
                stemp = stemp[0].Split('-');
                years = Convert.ToInt32(stemp[0]);
                mount = Convert.ToInt32(stemp[1]);
                day = Convert.ToInt32(stemp[2]);
                if (years > 2300)
                {
                    years = years - 543;
                }
                string years2 = years.ToString();
                string mount2 = mount.ToString();
                string day2 = day.ToString();                
                return (years2 + "-" + mount2 + "-" + day2);
            }
            catch (Exception)
            {

            }
            string years3 = years.ToString();
            string mount3 = mount.ToString();
            string day3 = day.ToString();            
            return (years3 + "-" + mount3 + "-" + day3);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            
        }

        protected void Button1_Click(object sender, EventArgs e)
        {            
            string start = ConvestToDate_check(TextBox1.Text);
            string end = ConvestToDate_check(TextBox2.Text);
            start = start + " " + "00:00:00";
            end = end + " " + "23:59:59";
            int status = Int32.Parse(RadioButtonList1.SelectedValue);
            //Session["start_date"] = start + " " + "00:00:00";
            //Session["end_date"] = end + " " + "23:59:59";
            Session["start_date"] = start;
            Session["end_date"] = end;
            Session["status"] = status;
            Page.Response.Redirect(Page.Request.Url.ToString(), true);
        }
       
        
    }
}